package castledefense.data;

import com.badlogic.gdx.graphics.Color;

/**
 * This class should contain every static method or static constant relative to
 * the game container. Exemple : SCREENSIZEX.
 * 
 * @author Gudradain
 * 
 */
public class GameData {

	public static int SCREENSIZEX = 800;
	public static int SCREENSIZEY = 600;

	public static int HALFSCREENSIZEX = SCREENSIZEX / 2;
	public static int HALFSCREENSIZEY = SCREENSIZEY / 2;

	public static final int noElement = -1;

	public static final int fire = 0;
	public static final int water = 1;
	public static final int earth = 2;
	public static final int air = 3;

	public static final int fireCd = 300000;
	public static final int waterCd = 120000;
	public static final int earthCd = 180000;
	public static final int airCd = 240000;

	public static final Color fireColor = Color.RED;
	public static final Color waterColor = Color.BLUE;
	public static final Color airColor = new Color(1f, 1f, 0, 1f);
	public static final Color earthColor = new Color(79f / 255f, 60f / 255f,
			32f / 255f, 1f);
	public static final Color noneColor = Color.WHITE;
	public static final Color gateColor = new Color(1f, 1f, 1f, 150f / 255f);
	public static final Color borderColor = Color.BLACK;

	public static final String noneString = "Normal";
	public static final String fireString = "Fire";
	public static final String waterString = "Water";
	public static final String earthString = "Earth";
	public static final String airString = "Air";

	public static final int oppositeElement = 0;
	public static final int resistanceElement = 1;
	public static final int noEffectElement = 2;

	public static final Color getColor(int type) {
		switch (type) {
		case fire:
			return fireColor;
		case water:
			return waterColor;
		case earth:
			return earthColor;
		case air:
			return airColor;
		}

		return noneColor;
	}

	public static final String getTypeName(int type) {
		switch (type) {
		case fire:
			return fireString;
		case water:
			return waterString;
		case earth:
			return earthString;
		case air:
			return airString;
		}

		return noneString;
	}

	public static int getCd(int type) {
		switch (type) {
		case fire:
			return fireCd;
		case water:
			return waterCd;
		case earth:
			return earthCd;
		case air:
			return airCd;
		}

		return 0;
	}

	public static int getElementEffect(int element1, int element2) {
		if (element1 == element2) {
			return resistanceElement;
		} else if ((element1 == fire && element2 == water)
				|| (element1 == earth && element2 == air)) {
			return oppositeElement;
		} else {
			return noEffectElement;
		}
	}

	public static void resize(int width, int height) {
		SCREENSIZEX = width;
		SCREENSIZEY = height;
		HALFSCREENSIZEX = SCREENSIZEX / 2;
		HALFSCREENSIZEY = SCREENSIZEY / 2;

	}

}
